ask

 

ask is a reporter that is used to make the agents in the agentset do something. The syntax of this command is ask *agentset/agent* [insert command here]. When ask is used with an agentset, each agent will take its turn in a random order. For example,

ask turtles [ fd 1 ] 
ask patches [set pcolor pink]

Each time this is run in the observer, either the turtles will move forward first or the patches will turn pink first. It is random every time!

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the ask primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the ask primitive:
 
 
Similar primitives:
neighbors

reports an agentset containing eight neighboring patches

Read more
patches

Address all patches of a model.

Read more
turtles

used to complete actions in NetLogo

Read more
 
Learn another primitive